<%--
  Created by IntelliJ IDEA.
  User: lanou
  Date: 18/1/16
  Time: 下午5:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@  taglib prefix="p" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>显示</title>
    <link href="https://cdn.bootcss.com/bootstrap/4.0.0-beta.3/css/bootstrap.css" rel="stylesheet">
</head>
<body>
    <form class="form-horizontal" role="form" action="select" method="post">
        <div class="form-group">
            <label for="firstname" class="col-sm-2 control-label">账号</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="firstname" placeholder="请输入账号" name="userName">
            </div>
        </div>
        <div class="form-group">
            <label for="lastname" class="col-sm-2 control-label">密码</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="lastname" placeholder="请输密码" name="userPwd">
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">查询</button>
            </div>
        </div>
    </form>

    <div>
        <table class="table table-hover">

            <thead>
            <tr>
                <th>id</th>
                <th>name</th>
                <th>pwd</th>
                <th>phone</th>
            </tr>
            </thead>
            <tbody>
            <p:forEach var="u" items="${requestScope.users}">
                <td>${u.id}</td>
                <td>${u.name}</td>
                <td>${u.pwd}</td>
                <td>${u.phone}</td>

            </tbody>
            </p:forEach>
        </table>

    </div>
    <div class="container">

        当前页：${requestScope.page}总页数：${requestScope.countP}<br>
        <ul class="pagination">
        <p:if test="${requestScope.page!=1}">
            <li ><a href="select?step=up&page=${page}&userName=${requestScope.userName}&userPwd=${requestScope.userPwd}">&laquo;</a></li>
        </p:if>
            <p:if test="${requestScope.page==1}">
                <li class="disabled"><a href="###">&laquo;</a></li>
            </p:if>


        <p:forEach var="i" items="${requestScope.num}">

                <li><a href="select?pageA=${i}&page=${page}">${i}</a></li>

        </p:forEach>


        <p:if test="${requestScope.down=='down'}">
        <li> <a href="select?step=down&page=${page}&userName=${requestScope.userName}&userPwd=${requestScope.userPwd}">&raquo;</a></li>
        </p:if>
            <p:if test="${requestScope.down!='down'}">
                <li> <a href="###">&raquo;</a></li>
            </p:if>

        </ul>
    </div>


   <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/4.0.0-beta.3/js/bootstrap.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
//            $("a").click(function () {
//                var data = $("form").serializeArray();
//                console.log(data);
//            })
        })

    </script>
</body>
</html>
